package com.example.model;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Project:
 * @CreateDate: Created in 2019/3/5 14:05
 * @Author: zjq
 */
public class Apple {

    private Integer id;
    private String color;
    private Integer weight;
    private String origin;  //产地

    public Apple(Integer id, String color, Integer weight, String origin) {
        this.id = id;
        this.color = color;
        this.weight = weight;
        this.origin = origin;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }

    @Override
    public String toString() {
        return "Apple{" +
                "id=" + id +
                ", color='" + color + '\'' +
                ", weight=" + weight +
                ", origin='" + origin + '\'' +
                '}';
    }


    public static void main(String[] args) {

        Apple a = new Apple(1, "2", 1, "2");

        List<Apple> list = new ArrayList<>();
        list.add(a);
        a.setId(2);
        list.remove(a);
        list.add(a);

        System.out.println(list.toString());

    }


}
